#!/usr/bin/awk -f
BEGIN {}
{
  s=$1; # predicate

  # build id lookup table for predicates
  if (!(s in s_list))
    s_list[s] = count++;
}
END {
  count=0;

  # process all stored subjects/objects
  for (s in s_list) {
    print s_list[s], s;
  }
}
